#include <stdio.h>
#include <stdlib.h>
#include<conio.h >
int main()
{
	int j, k, b;
	int x = 20, y = 20;
	char shuru;
	int kaihuo = 0;
	int n = 15;
	int jisha = 0;
	while (1) {
		system("cls");
		if (!jisha) {
			for (b = 0; b < n; b++) {
				printf(" ");
			}
			printf("  +");
		}
		if (n == x&&kaihuo==1) {
			jisha = 1;
		}
		if (kaihuo == 0) {
			for (j = 0; j < y; j++) {
				printf("\n");
			}
		}
		else {
			for (k = 0; k < y; k++) {
				for (j = 0; j < x; j++) {
					printf(" ");
				}
				printf("  |\n");
				kaihuo = 0;
			}
		}

		for (j = 0; j < x; j++) {
			printf(" ");
		}
		printf("  *\n");

		for (j = 0; j < x; j++) {
			printf(" ");
		}
		printf("*****\n ");

		for (j = 0; j < x; j++) {
			printf(" ");
		}
		printf("* * \n ");
		if (_kbhit()) {
			shuru = _getch();
			if (shuru == 'a') {
				x--;
			}
			if (shuru == 'd') {
				x++;
			}
			if (shuru == 'w') {
				y--;
			}	if (shuru == 's') {
				y++;
			}
			if (shuru == ' ') {
				kaihuo = 1;
			}
		}
	}



	return 0;
}